<template>
  <div class="main">
    <el-tabs>
      <!-- <el-input v-model="input" placeholder="搜索考试名称" maxlength="100"></el-input> -->

      <el-tab-pane label="用户管理"
        ><el-table ref="filterTable" :data="tableData" style="width: 100%">
          <el-table-column prop="date" label="考试名称" width="500" column-key="date">
          </el-table-column>
          <el-table-column prop="name" label="时长" width="100"> </el-table-column>
          <el-table-column prop="address" label="总分" width="100"></el-table-column>
          <el-table-column prop="jige" label="及格分" width="100"> </el-table-column>
          <el-table-column prop="rengong" label="人工阅卷" width="100"> </el-table-column>
          <el-table-column prop="kaifang" label="开放时间" width="300"> </el-table-column>

          <el-table-column
            prop="tag"
            label="标签"
            width="100"
            :filters="[
              { text: '家', value: '家' },
              { text: '公司', value: '公司' },
            ]"
            filter-placement="bottom-end"
          >
            <template slot-scope="scope">
              <el-tag
                :type="scope.row.tag === '家' ? 'primary' : 'success'"
                disable-transitions
                >{{ scope.row.tag }}</el-tag
              >
            </template>
          </el-table-column>
          <el-table-column label="操作">
            <template slot-scope="scope">
              <el-button
                size="mini"
                type="danger"
                @click="deleteHomeIndex(scope.$index)"
                >删除</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <div class="block">
          <el-pagination
            :page-sizes="[1, 2, 3, 4]"
            :page-size="100"
            layout="total, sizes, prev, pager, next, jumper"
            :total="10"
          >
          </el-pagination>
        </div>
      </el-tab-pane>
      <el-tab-pane label="用户管理">暂无数据</el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import instance from "../api/index";
export default {
  name: "CompeView",
  data() {
    return {
      input: null,
      tableData: null,
    };
  },
  methods: {
    async getHomeIndex() {
      let { data } = await instance.get("/homeindex");
      console.log(data);
      this.tableData = data;
      console.log(this.tableData);
    },
     async deleteHomeIndex(index) {
      let {data} = await instance.delete("/homeindex/" + index);
      console.log(data);
      this.getHomeIndex()
    },
  },
  created(){
    this.getHomeIndex()
  }
};
</script>
<style>
.main {
  width: 1585px;
  height: 810px;
  margin: 0 auto;
  margin-top: 25px;
}
.block {
  width: 1000px;
  margin: 0 auto;
  margin-top: 25px;
}
</style>
